package com.dyit.controller;

import com.dyit.dto.HttpResp;
import com.dyit.service.IBookService;
import com.dyit.vo.BookVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/book")
public class BookController {//首页直接显示所有图书的分类和占比
    @Autowired
    private IBookService iBookService;
    @ApiOperation("显示书的种类和其对应的数量")
    @GetMapping("/countBookByCategory")
    public HttpResp countBookByCategory(){
        List<BookVo> bookVos = iBookService.countBookByCategory();
        return new HttpResp(20001,"success!",bookVos,null);
    }
}
